/**
 * 
 */
package com.magus.project.yddemo.service;

import java.sql.Date;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.List;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.util.CellRangeAddress;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.magus.framework.core.persistence.JpaSearchUtils;
import com.magus.framework.core.persistence.SearchFilter;
import com.magus.framework.core.repository.BaseRepository;
import com.magus.framework.core.service.BaseService;
import com.magus.project.yddemo.entity.IndicatorMapperData;
import com.magus.project.yddemo.entity.IndicatorMapperReport3;
import com.magus.project.yddemo.repository.IndicatorMapperReport3Repository;

/**
 * @author wenyu.han
 * @date 2018-03-29 09:16:47
 */
@Service
@Transactional(readOnly = true)
public class IndicatorMapperReport3Service extends BaseService<IndicatorMapperReport3, String> {

	@Autowired
	private IndicatorMapperReport3Repository reportRepository;

	@Autowired
	private IndicatorMapperDataService mapperDataService;

	@Override
	protected BaseRepository<IndicatorMapperReport3, String> getBaseRepository() {
		return reportRepository;
	}

	// 6000千瓦及以下电厂合计行号
	static final Integer ROW = 42;

	// 数据起始行号
	static final Integer ROW_INDEX = 12;

	/**
	 * 每行的固定列用##符号分开
	 */
	static final String[] ALL_ROW_NAME = new String[] { "一、合计##01##null", "（一）水电##0101##null", "其中：抽水蓄能##010101##null",
			"（二）火电##0102##null", "1、燃煤##010201##null", "其中：煤矸石发电##01020101##null", " 2、燃气##010202##null",
			"其中：煤层气发电##01020201##null", "沼气发电##01020202##null", "3、燃油##010203##null", "4、其他##010204##null",
			"其中：余温、余压、余气发电##01020401##null", "垃圾焚烧发电##01020402##null", "秸秆、蔗渣、林木质发电##01020403##null",
			"（三）核电##0103##null", "（四）风电##0104##null", "（五）太阳能发电##0105##null", "（六）其他##0106##null",
			"1、地热能##010601##null", "2、海洋能##010602##null", "3、其他##010603##null", "二、6000千瓦及以上电厂合计##02##null",
			"（一）水电##0201##null", "其中：抽水蓄能##020101##null", "（二）火电##0202##null", "1、燃煤##020201##null",
			"其中：煤矸石发电##02020101##null", "2、燃气##020202##null", "其中：煤层气发电##02020201##null", "沼气发电##02020202##null",
			"3、燃油##020203##null", "4、其他##020204##null", "其中：余温、余压、余气发电##02020401##null", "垃圾焚烧发电##02020402##null",
			"秸秆、蔗渣、林木质发电##02020403##null", "（三）核电##0203##null", "（四）风电##0204##null", "（五）太阳能发电##0205##null",
			"（六）其他##0206##null", "1、地热能##020601##null", "2、海洋能##020602##null", "3、其他##020603##null",
			"三、6000千瓦以下电厂合计##03##null", "（一）水电##0301##null", "（二）火电##0302##null", "1、燃煤##030201##null",
			"2、燃气##030202##null", "其中：煤层气发电##03020201##null", "沼气发电##03020202##null", "3、燃油##030203##null",
			"4、其他##030204##null", "其中：余温、余压、余气发电##03020401##null", "垃圾焚烧发电##03020402##null",
			"秸秆、蔗渣、林木质发电##03020403##null", "（三）风电##0303##null", "（四）太阳能发电##0304##null", "（五）其他##0305##null",
			"1、地热能##030501##null", "2、海洋能##030502##null", "3、其他##030503##null", "四、6000千瓦及以上电厂明细##04##null",
			"广东粤电新丰江发电有限责任公司##04001##75108654-6", "广东粤电枫树坝发电有限责任公司##04002##75105009－2",
			"广东粤电青溪发电有限责任公司##04003##19642347-7", "广东粤电长湖发电有限责任公司##04004##197770796",
			"广东粤电南水发电有限责任公司##04005##x1746601-8", "广东粤电长潭发电有限责任公司##04006##19667395-1",
			"广东粤电流溪河发电有限责任公司##04007##19033515-0", "大埔县梅江蓬辣滩水电站有限公司##04008##73989594-9",
			"天生桥一级水电开发有限责任公司水力发电厂##04009##73096079-1", "临沧粤电能源有限公司新塘房电厂##04010##7704814-5",
			"临沧粤电能源有限公司南荣田电厂##04011##7704814-5", "广东电力发展股份有限公司沙角A电厂##04012##73148621-9",
			"广东粤电集团有限公司沙角C电厂##04013##74369834-X", "广东省粤电集团有限公司珠海发电厂##04014##70812907—X",
			"广东粤华发电有限责任公司##04015##19032084-8", "湛江电力有限公司##04016##23210093-2", "广东省韶关粤江发电有限责任公司##04017##70752208-0",
			"茂名臻能热电有限公司##04018##76656459-8", "广东粤嘉电力有限公司##04019##61741361-4", "广东粤电云河发电有限公司##04020##69475944-0",
			"广东省粤泷发电有限责任公司##04021##61785108-3", "广东珠海金湾发电有限公司##04022##71785911－1", "广东红海湾发电有限公司##04023##77307022-X",
			"广东粤电靖海发电有限公司##04024##76061818-8", "广东惠州平海发电厂有限公司##04025##791172465", "贵州粤黔电力有限责任公司##04026##61806419-6",
			"湛江中粤能源有限公司##04027##74367331-0", "广东粤电大埔发电有限公司##04028##06145024-0", "广东惠州天然气发电有限公司##04029##791172465",
			"深圳市广前电力有限公司##04030##76380066-3", "广东粤电湛江生物质发电有限公司##04031##68056594-4", "广东粤电石碑山风能开发有限公司##04032##791172465",
			"广东粤电湛江风力发电有限公司##04033##79295197-0", "惠来风力发电有限公司##04034##70762183-9", "广东粤电电白风力发电有限公司##04035##071911813",
			"贵州粤电六盘水综合能源有限公司##04036##098548129", "贵州粤电遵义风能有限公司仙人山风电场##04037##098956288",
			"贵州粤电石阡风能有限公司大顶山风电场##04038##085652306", "广州开发区粤电新能源有限公司##04039##082711868",
			"广东粤电阳西新能源有限公司##04040##MA4UM48Y1" };

	/**
	 * ########指标按照报表行顺序进行排列######## ########如果指标明细中为空的指标，用""标识########
	 * 期末发电设备容量6000千瓦及以上电厂全部指标
	 */
	static final String[] QMFDSB_ALL = new String[] { "XFJ_MPRL_M_M_M_SUM_M_CTST", "FSB_MPRL_M_M_M_SUM_M_CTST",
			"QXH_MPRL_M_M_M_SUM_M_CTST", "CHH_MPRL_M_M_M_SUM_M_CTST", "NSH_MPRL_M_M_M_SUM_M_CTST",
			"CTH_MPRL_M_M_M_SUM_M_CTST", "LXH_MPRL_M_M_M_SUM_M_CTST", "PLT_MPRL_M_M_M_SUM_M_CTST",
			"TSQ_MPRL_M_M_M_SUM_M_CTST", "LCC_MPRL_M_M_M_SUM_M_CTST", "", "SJA_MPRL_M_M_M_SUM_M_CTST",
			"SJC_MPRL_M_M_M_SUM_M_CTST", "ZHP_MPRL_M_M_M_SUM_M_CTST", "HPP_MPRL_M_M_M_SUM_M_CTST",
			"ZJP_MPRL_M_M_M_SUM_M_CTST", "SGY_MPRL_M_M_M_SUM_M_CTST", "MMP_MPRL_M_M_M_SUM_M_CTST",
			"MXP_MPRL_M_M_M_SUM_M_CTST", "YHP_MPRL_M_M_M_SUM_M_CTST", "YLP_MPRL_M_M_M_SUM_M_CTST",
			"JWP_MPRL_M_M_M_SUM_M_CTST", "HHW_MPRL_M_M_M_SUM_M_CTST", "JHP_MPRL_M_M_M_SUM_M_CTST",
			"PHP_MPRL_M_M_M_SUM_M_CTST", "GZH_MPRL_M_M_M_SUM_M_CTST", "TSP_MPRL_M_M_M_SUM_M_CTST",
			"DPP_MPRL_M_M_M_SUM_M_CTST", "HZL_MPRL_M_M_M_SUM_M_CTST", "GQL_MPRL_M_M_M_SUM_M_CTST",
			"SWF_MPRL_M_M_M_SUM_M_CTST", "SBS_MPRL_M_M_M_SUM_M_CTST", "ZJW_MPRL_M_M_M_SUM_M_CTST",
			"HLW_MPRL_M_M_M_SUM_M_CTST", "DBW_MPRL_M_M_M_SUM_M_CTST", "PXW_MPRL_M_M_M_SUM_M_CTST",
			"ZYW_MPRL_M_M_M_SUM_M_CTST", "SQW_MPRL_M_M_M_SUM_M_CTST", "KFE_MPRL_M_M_M_SUM_M_CTST",
			"YXX_MPRL_M_M_M_SUM_M_CTST"

	};

	/**
	 * 期末发电设备容量6000千瓦及以上水电全部指标
	 */
	static final String[] QMFDSB_SD = new String[] { "XFJ_MPRL_M_M_M_SUM_M_CTST", "FSB_MPRL_M_M_M_SUM_M_CTST",
			"QXH_MPRL_M_M_M_SUM_M_CTST", "CHH_MPRL_M_M_M_SUM_M_CTST", "NSH_MPRL_M_M_M_SUM_M_CTST",
			"CTH_MPRL_M_M_M_SUM_M_CTST", "LXH_MPRL_M_M_M_SUM_M_CTST", "PLT_MPRL_M_M_M_SUM_M_CTST",
			"TSQ_MPRL_M_M_M_SUM_M_CTST", "LCC_MPRL_M_M_M_SUM_M_CTST", "" };

	/**
	 * 期末发电设备容量6000千瓦及以上火电全部指标
	 */
	static final String[] QMFDSB_HD = new String[] { "SJA_MPRL_M_M_M_SUM_M_CTST", "SJC_MPRL_M_M_M_SUM_M_CTST",
			"ZHP_MPRL_M_M_M_SUM_M_CTST", "HPP_MPRL_M_M_M_SUM_M_CTST", "ZJP_MPRL_M_M_M_SUM_M_CTST",
			"SGY_MPRL_M_M_M_SUM_M_CTST", "MMP_MPRL_M_M_M_SUM_M_CTST", "MXP_MPRL_M_M_M_SUM_M_CTST",
			"YHP_MPRL_M_M_M_SUM_M_CTST", "YLP_MPRL_M_M_M_SUM_M_CTST", "JWP_MPRL_M_M_M_SUM_M_CTST",
			"HHW_MPRL_M_M_M_SUM_M_CTST", "JHP_MPRL_M_M_M_SUM_M_CTST", "PHP_MPRL_M_M_M_SUM_M_CTST",
			"GZH_MPRL_M_M_M_SUM_M_CTST", "TSP_MPRL_M_M_M_SUM_M_CTST", "DPP_MPRL_M_M_M_SUM_M_CTST",
			"HZL_MPRL_M_M_M_SUM_M_CTST", "GQL_MPRL_M_M_M_SUM_M_CTST", "SWF_MPRL_M_M_M_SUM_M_CTST" };

	/**
	 * 期末发电设备容量6000千瓦及以上火电燃煤指标
	 */
	static final String[] QMFDSB_HD_RM = new String[] { "SJA_MPRL_M_M_M_SUM_M_CTST", "SJC_MPRL_M_M_M_SUM_M_CTST",
			"ZHP_MPRL_M_M_M_SUM_M_CTST", "HPP_MPRL_M_M_M_SUM_M_CTST", "ZJP_MPRL_M_M_M_SUM_M_CTST",
			"SGY_MPRL_M_M_M_SUM_M_CTST", "MMP_MPRL_M_M_M_SUM_M_CTST", "MXP_MPRL_M_M_M_SUM_M_CTST",
			"YHP_MPRL_M_M_M_SUM_M_CTST", "YLP_MPRL_M_M_M_SUM_M_CTST", "JWP_MPRL_M_M_M_SUM_M_CTST",
			"HHW_MPRL_M_M_M_SUM_M_CTST", "JHP_MPRL_M_M_M_SUM_M_CTST", "PHP_MPRL_M_M_M_SUM_M_CTST",
			"GZH_MPRL_M_M_M_SUM_M_CTST", "TSP_MPRL_M_M_M_SUM_M_CTST", "DPP_MPRL_M_M_M_SUM_M_CTST" };

	/**
	 * 期末发电设备容量6000千瓦及以上火电燃气指标
	 */
	static final String[] QMFDSB_HD_RQ = new String[] { "HZL_MPRL_M_M_M_SUM_M_CTST", "GQL_MPRL_M_M_M_SUM_M_CTST" };

	/**
	 * 期末发电设备容量6000千瓦及以上火电其他指标
	 */
	static final String[] QMFDSB_HD_QT = new String[] { "SWF_MPRL_M_M_M_SUM_M_CTST" };

	/**
	 * 期末发电设备容量6000千瓦及以上风电全部指标
	 */
	static final String[] QMFDSB_FD = new String[] { "SBS_MPRL_M_M_M_SUM_M_CTST", "ZJW_MPRL_M_M_M_SUM_M_CTST",
			"HLW_MPRL_M_M_M_SUM_M_CTST", "DBW_MPRL_M_M_M_SUM_M_CTST", "PXW_MPRL_M_M_M_SUM_M_CTST",
			"ZYW_MPRL_M_M_M_SUM_M_CTST", "SQW_MPRL_M_M_M_SUM_M_CTST" };

	/**
	 * 期末发电设备容量6000千瓦及以上太阳能全部指标
	 */
	static final String[] QMFDSB_TYN = new String[] { "KFE_MPRL_M_M_M_SUM_M_CTST", "YXX_MPRL_M_M_M_SUM_M_CTST" };

	/**
	 * 发电量_6000千瓦及以上电厂全部指标
	 */
	static final String[] FDL_ALL = new String[] { "XFJ_FDL_M_M_M_SUM_M_MANL", "FSB_FDL_M_M_M_SUM_M_MANL",
			"QXH_FDL_M_M_M_SUM_M_MANL", "CHH_FDL_M_M_M_SUM_M_MANL", "NSH_FDL_M_M_M_SUM_M_MANL",
			"CTH_FDL_M_M_M_SUM_M_MANL", "LXH_FDL_M_M_M_SUM_M_MANL", "PLT_FDL_M_M_M_SUM_M_MANL",
			"TSQ_FDL_M_M_M_SUM_M_MANL", "LCC_FDL_M_M_M_SUM_M_MANL", "", "SJA_FDL_M_M_M_SUM_M_MANL",
			"SJC_FDL_M_M_M_SUM_M_MANL", "ZHP_FDL_M_M_M_SUM_M_MANL", "HPP_FDL_M_M_M_SUM_M_MANL",
			"ZJP_FDL_M_M_M_SUM_M_MANL", "SGY_FDL_M_M_M_SUM_M_MANL", "MMP_FDL_M_M_M_SUM_M_MANL",
			"MXP_FDL_M_M_M_SUM_M_MANL", "YHP_FDL_M_M_M_SUM_M_MANL", "YLP_FDL_M_M_M_SUM_M_MANL",
			"JWP_FDL_M_M_M_SUM_M_MANL", "HHW_FDL_M_M_M_SUM_M_MANL", "JHP_FDL_M_M_M_SUM_M_MANL",
			"PHP_FDL_M_M_M_SUM_M_MANL", "GZH_FDL_M_M_M_SUM_M_MANL", "TSP_FDL_M_M_M_SUM_M_MANL",
			"DPP_FDL_M_M_M_SUM_M_MANL", "HZL_FDL_M_M_M_SUM_M_MANL", "GQL_FDL_M_M_M_SUM_M_MANL",
			"SWF_FDL_M_M_M_SUM_M_MANL", "SBS_FDL_M_M_M_SUM_M_MANL", "ZJW_FDL_M_M_M_SUM_M_MANL",
			"HLW_FDL_M_M_M_SUM_M_MANL", "DBW_FDL_M_M_M_SUM_M_MANL", "PXW_FDL_M_M_M_SUM_M_MANL",
			"ZYW_FDL_M_M_M_SUM_M_MANL", "SQW_FDL_M_M_M_SUM_M_MANL", "KFE_FDL_M_M_M_SUM_M_MANL",
			"YXX_FDL_M_M_M_SUM_M_MANL" };

	/**
	 * 发电量_6000千瓦及以上水电全部指标
	 */
	static final String[] FDL_SD = new String[] { "XFJ_FDL_M_M_M_SUM_M_MANL", "FSB_FDL_M_M_M_SUM_M_MANL",
			"QXH_FDL_M_M_M_SUM_M_MANL", "CHH_FDL_M_M_M_SUM_M_MANL", "NSH_FDL_M_M_M_SUM_M_MANL",
			"CTH_FDL_M_M_M_SUM_M_MANL", "LXH_FDL_M_M_M_SUM_M_MANL", "PLT_FDL_M_M_M_SUM_M_MANL",
			"TSQ_FDL_M_M_M_SUM_M_MANL", "LCC_FDL_M_M_M_SUM_M_MANL", "" };

	/**
	 * 发电量_6000千瓦及以上火电全部指标
	 */
	static final String[] FDL_HD = new String[] { "SJA_FDL_M_M_M_SUM_M_MANL", "SJC_FDL_M_M_M_SUM_M_MANL",
			"ZHP_FDL_M_M_M_SUM_M_MANL", "HPP_FDL_M_M_M_SUM_M_MANL", "ZJP_FDL_M_M_M_SUM_M_MANL",
			"SGY_FDL_M_M_M_SUM_M_MANL", "MMP_FDL_M_M_M_SUM_M_MANL", "MXP_FDL_M_M_M_SUM_M_MANL",
			"YHP_FDL_M_M_M_SUM_M_MANL", "YLP_FDL_M_M_M_SUM_M_MANL", "JWP_FDL_M_M_M_SUM_M_MANL",
			"HHW_FDL_M_M_M_SUM_M_MANL", "JHP_FDL_M_M_M_SUM_M_MANL", "PHP_FDL_M_M_M_SUM_M_MANL",
			"GZH_FDL_M_M_M_SUM_M_MANL", "TSP_FDL_M_M_M_SUM_M_MANL", "DPP_FDL_M_M_M_SUM_M_MANL",
			"HZL_FDL_M_M_M_SUM_M_MANL", "GQL_FDL_M_M_M_SUM_M_MANL", "SWF_FDL_M_M_M_SUM_M_MANL" };

	/**
	 * 发电量_6000千瓦及以上火电燃煤指标
	 */
	static final String[] FDL_HD_RM = new String[] { "SJA_FDL_M_M_M_SUM_M_MANL", "SJC_FDL_M_M_M_SUM_M_MANL",
			"ZHP_FDL_M_M_M_SUM_M_MANL", "HPP_FDL_M_M_M_SUM_M_MANL", "ZJP_FDL_M_M_M_SUM_M_MANL",
			"SGY_FDL_M_M_M_SUM_M_MANL", "MMP_FDL_M_M_M_SUM_M_MANL", "MXP_FDL_M_M_M_SUM_M_MANL",
			"YHP_FDL_M_M_M_SUM_M_MANL", "YLP_FDL_M_M_M_SUM_M_MANL", "JWP_FDL_M_M_M_SUM_M_MANL",
			"HHW_FDL_M_M_M_SUM_M_MANL", "JHP_FDL_M_M_M_SUM_M_MANL", "PHP_FDL_M_M_M_SUM_M_MANL",
			"GZH_FDL_M_M_M_SUM_M_MANL", "TSP_FDL_M_M_M_SUM_M_MANL", "DPP_FDL_M_M_M_SUM_M_MANL" };

	/**
	 * 发电量_6000千瓦及以上火电燃气指标
	 */
	static final String[] FDL_HD_RQ = new String[] { "HZL_FDL_M_M_M_SUM_M_MANL", "GQL_FDL_M_M_M_SUM_M_MANL" };

	/**
	 * 发电量_6000千瓦及以上火电其他指标
	 */
	static final String[] FDL_HD_QT = new String[] { "SWF_FDL_M_M_M_SUM_M_MANL" };

	/**
	 * 发电量_6000千瓦及以上风电全部指标
	 */
	static final String[] FDL_FD = new String[] { "SBS_FDL_M_M_M_SUM_M_MANL", "ZJW_FDL_M_M_M_SUM_M_MANL",
			"HLW_FDL_M_M_M_SUM_M_MANL", "DBW_FDL_M_M_M_SUM_M_MANL", "PXW_FDL_M_M_M_SUM_M_MANL",
			"ZYW_FDL_M_M_M_SUM_M_MANL", "SQW_FDL_M_M_M_SUM_M_MANL" };

	/**
	 * 发电量_6000千瓦及以上太阳能全部指标
	 */
	static final String[] FDL_TYN = new String[] { "KFE_FDL_M_M_M_SUM_M_MANL", "YXX_FDL_M_M_M_SUM_M_MANL" };

	/**
	 * 上网电量_6000千瓦及以上电厂全部指标
	 */
	static final String[] SWDL_ALL = new String[] { "XFJ_SWDL_M_M_M_SUM_M_MANL", "FSB_SWDL_M_M_M_SUM_M_MANL",
			"QXH_SWDL_M_M_M_SUM_M_MANL", "CHH_SWDL_M_M_M_SUM_M_MANL", "NSH_SWDL_M_M_M_SUM_M_MANL",
			"CTH_SWDL_M_M_M_SUM_M_MANL", "LXH_SWDL_M_M_M_SUM_M_MANL", "PLT_SWDL_M_M_M_SUM_M_MANL",
			"TSQ_SWDL_M_M_M_SUM_M_MANL", "LCC_SWDL_M_M_M_SUM_M_MANL", "", "SJA_SWDL_M_M_M_SUM_M_MANL",
			"SJC_SWDL_M_M_M_SUM_M_MANL", "ZHP_SWDL_M_M_M_SUM_M_MANL", "HPP_SWDL_M_M_M_SUM_M_MANL",
			"ZJP_SWDL_M_M_M_SUM_M_MANL", "SGY_SWDL_M_M_M_SUM_M_MANL", "MMP_SWDL_M_M_M_SUM_M_MANL",
			"MXP_SWDL_M_M_M_SUM_M_MANL", "YHP_SWDL_M_M_M_SUM_M_MANL", "YLP_SWDL_M_M_M_SUM_M_MANL",
			"JWP_SWDL_M_M_M_SUM_M_MANL", "HHW_SWDL_M_M_M_SUM_M_MANL", "JHP_SWDL_M_M_M_SUM_M_MANL",
			"PHP_SWDL_M_M_M_SUM_M_MANL", "GZH_SWDL_M_M_M_SUM_M_MANL", "TSP_SWDL_M_M_M_SUM_M_MANL",
			"DPP_SWDL_M_M_M_SUM_M_MANL", "HZL_SWDL_M_M_M_SUM_M_MANL", "GQL_SWDL_M_M_M_SUM_M_MANL",
			"SWF_SWDL_M_M_M_SUM_M_MANL", "SBS_SWDL_M_M_M_SUM_M_MANL", "ZJW_SWDL_M_M_M_SUM_M_MANL",
			"HLW_SWDL_M_M_M_SUM_M_MANL", "DBW_SWDL_M_M_M_SUM_M_MANL", "PXW_SWDL_M_M_M_SUM_M_MANL",
			"ZYW_SWDL_M_M_M_SUM_M_MANL", "SQW_SWDL_M_M_M_SUM_M_MANL", "KFE_SWDL_M_M_M_SUM_M_MANL",
			"YXX_SWDL_M_M_M_SUM_M_MANL"

	};

	/**
	 * 上网电量_6000千瓦及以上水电全部指标
	 */
	static final String[] SWDL_SD = new String[] { "XFJ_SWDL_M_M_M_SUM_M_MANL", "FSB_SWDL_M_M_M_SUM_M_MANL",
			"QXH_SWDL_M_M_M_SUM_M_MANL", "CHH_SWDL_M_M_M_SUM_M_MANL", "NSH_SWDL_M_M_M_SUM_M_MANL",
			"CTH_SWDL_M_M_M_SUM_M_MANL", "LXH_SWDL_M_M_M_SUM_M_MANL", "PLT_SWDL_M_M_M_SUM_M_MANL",
			"TSQ_SWDL_M_M_M_SUM_M_MANL", "LCC_SWDL_M_M_M_SUM_M_MANL", "" };

	/**
	 * 上网电量_6000千瓦及以上火电全部指标
	 */
	static final String[] SWDL_HD = new String[] { "SJA_SWDL_M_M_M_SUM_M_MANL", "SJC_SWDL_M_M_M_SUM_M_MANL",
			"ZHP_SWDL_M_M_M_SUM_M_MANL", "HPP_SWDL_M_M_M_SUM_M_MANL", "ZJP_SWDL_M_M_M_SUM_M_MANL",
			"SGY_SWDL_M_M_M_SUM_M_MANL", "MMP_SWDL_M_M_M_SUM_M_MANL", "MXP_SWDL_M_M_M_SUM_M_MANL",
			"YHP_SWDL_M_M_M_SUM_M_MANL", "YLP_SWDL_M_M_M_SUM_M_MANL", "JWP_SWDL_M_M_M_SUM_M_MANL",
			"HHW_SWDL_M_M_M_SUM_M_MANL", "JHP_SWDL_M_M_M_SUM_M_MANL", "PHP_SWDL_M_M_M_SUM_M_MANL",
			"GZH_SWDL_M_M_M_SUM_M_MANL", "TSP_SWDL_M_M_M_SUM_M_MANL", "DPP_SWDL_M_M_M_SUM_M_MANL",
			"HZL_SWDL_M_M_M_SUM_M_MANL", "GQL_SWDL_M_M_M_SUM_M_MANL", "SWF_SWDL_M_M_M_SUM_M_MANL" };

	/**
	 * 上网电量_6000千瓦及以上火电燃煤指标
	 */
	static final String[] SWDL_HD_RM = new String[] { "SJA_SWDL_M_M_M_SUM_M_MANL", "SJC_SWDL_M_M_M_SUM_M_MANL",
			"ZHP_SWDL_M_M_M_SUM_M_MANL", "HPP_SWDL_M_M_M_SUM_M_MANL", "ZJP_SWDL_M_M_M_SUM_M_MANL",
			"SGY_SWDL_M_M_M_SUM_M_MANL", "MMP_SWDL_M_M_M_SUM_M_MANL", "MXP_SWDL_M_M_M_SUM_M_MANL",
			"YHP_SWDL_M_M_M_SUM_M_MANL", "YLP_SWDL_M_M_M_SUM_M_MANL", "JWP_SWDL_M_M_M_SUM_M_MANL",
			"HHW_SWDL_M_M_M_SUM_M_MANL", "JHP_SWDL_M_M_M_SUM_M_MANL", "PHP_SWDL_M_M_M_SUM_M_MANL",
			"GZH_SWDL_M_M_M_SUM_M_MANL", "TSP_SWDL_M_M_M_SUM_M_MANL", "DPP_SWDL_M_M_M_SUM_M_MANL" };

	/**
	 * 上网电量_6000千瓦及以上火电燃气指标
	 */
	static final String[] SWDL_HD_RQ = new String[] { "HZL_SWDL_M_M_M_SUM_M_MANL", "GQL_SWDL_M_M_M_SUM_M_MANL" };

	/**
	 * 上网电量_6000千瓦及以上火电其他指标
	 */
	static final String[] SWDL_HD_QT = new String[] { "SWF_SWDL_M_M_M_SUM_M_MANL" };

	/**
	 * 上网电量_6000千瓦及以上风电全部指标
	 */
	static final String[] SWDL_FD = new String[] { "SBS_SWDL_M_M_M_SUM_M_MANL", "ZJW_SWDL_M_M_M_SUM_M_MANL",
			"HLW_SWDL_M_M_M_SUM_M_MANL", "DBW_SWDL_M_M_M_SUM_M_MANL", "PXW_SWDL_M_M_M_SUM_M_MANL",
			"ZYW_SWDL_M_M_M_SUM_M_MANL", "SQW_SWDL_M_M_M_SUM_M_MANL" };

	/**
	 * 上网电量_6000千瓦及以上太阳能全部指标
	 */
	static final String[] SWDL_TYN = new String[] { "KFE_SWDL_M_M_M_SUM_M_MANL", "YXX_SWDL_M_M_M_SUM_M_MANL" };

	/**
	 * 平均设备容量_6000千瓦及以上电厂全部指标
	 */
	static final String[] PJSB_ALL = new String[] { "XFJ_MPRL_M_M_M_SUM_M_CTST", "FSB_MPRL_M_M_M_SUM_M_CTST",
			"QXH_MPRL_M_M_M_SUM_M_CTST", "CHH_MPRL_M_M_M_SUM_M_CTST", "NSH_MPRL_M_M_M_SUM_M_CTST",
			"CTH_MPRL_M_M_M_SUM_M_CTST", "LXH_MPRL_M_M_M_SUM_M_CTST", "PLT_MPRL_M_M_M_SUM_M_CTST",
			"TSQ_MPRL_M_M_M_SUM_M_CTST", "LCC_MPRL_M_M_M_SUM_M_CTST", "", "SJA_MPRL_M_M_M_SUM_M_CTST",
			"SJC_MPRL_M_M_M_SUM_M_CTST", "ZHP_MPRL_M_M_M_SUM_M_CTST", "HPP_MPRL_M_M_M_SUM_M_CTST",
			"ZJP_MPRL_M_M_M_SUM_M_CTST", "SGY_MPRL_M_M_M_SUM_M_CTST", "MMP_MPRL_M_M_M_SUM_M_CTST",
			"MXP_MPRL_M_M_M_SUM_M_CTST", "YHP_MPRL_M_M_M_SUM_M_CTST", "YLP_MPRL_M_M_M_SUM_M_CTST",
			"JWP_MPRL_M_M_M_SUM_M_CTST", "HHW_MPRL_M_M_M_SUM_M_CTST", "JHP_MPRL_M_M_M_SUM_M_CTST",
			"PHP_MPRL_M_M_M_SUM_M_CTST", "GZH_MPRL_M_M_M_SUM_M_CTST", "TSP_MPRL_M_M_M_SUM_M_CTST",
			"DPP_MPRL_M_M_M_SUM_M_CTST", "HZL_MPRL_M_M_M_SUM_M_CTST", "GQL_MPRL_M_M_M_SUM_M_CTST",
			"SWF_MPRL_M_M_M_SUM_M_CTST", "SBS_MPRL_M_M_M_SUM_M_CTST", "ZJW_MPRL_M_M_M_SUM_M_CTST",
			"HLW_MPRL_M_M_M_SUM_M_CTST", "DBW_MPRL_M_M_M_SUM_M_CTST", "PXW_MPRL_M_M_M_SUM_M_CTST",
			"ZYW_MPRL_M_M_M_SUM_M_CTST", "SQW_MPRL_M_M_M_SUM_M_CTST", "KFE_MPRL_M_M_M_SUM_M_CTST",
			"YXX_MPRL_M_M_M_SUM_M_CTST" };

	/**
	 * 平均设备容量_6000千瓦及以上水电全部指标
	 */
	static final String[] PJSB_SD = new String[] { "XFJ_MPRL_M_M_M_SUM_M_CTST", "FSB_MPRL_M_M_M_SUM_M_CTST",
			"QXH_MPRL_M_M_M_SUM_M_CTST", "CHH_MPRL_M_M_M_SUM_M_CTST", "NSH_MPRL_M_M_M_SUM_M_CTST",
			"CTH_MPRL_M_M_M_SUM_M_CTST", "LXH_MPRL_M_M_M_SUM_M_CTST", "PLT_MPRL_M_M_M_SUM_M_CTST",
			"TSQ_MPRL_M_M_M_SUM_M_CTST", "LCC_MPRL_M_M_M_SUM_M_CTST", "" };

	/**
	 * 平均设备容量_6000千瓦及以上火电全部指标
	 */
	static final String[] PJSB_HD = new String[] { "SJA_MPRL_M_M_M_SUM_M_CTST", "SJC_MPRL_M_M_M_SUM_M_CTST",
			"ZHP_MPRL_M_M_M_SUM_M_CTST", "HPP_MPRL_M_M_M_SUM_M_CTST", "ZJP_MPRL_M_M_M_SUM_M_CTST",
			"SGY_MPRL_M_M_M_SUM_M_CTST", "MMP_MPRL_M_M_M_SUM_M_CTST", "MXP_MPRL_M_M_M_SUM_M_CTST",
			"YHP_MPRL_M_M_M_SUM_M_CTST", "YLP_MPRL_M_M_M_SUM_M_CTST", "JWP_MPRL_M_M_M_SUM_M_CTST",
			"HHW_MPRL_M_M_M_SUM_M_CTST", "JHP_MPRL_M_M_M_SUM_M_CTST", "PHP_MPRL_M_M_M_SUM_M_CTST",
			"GZH_MPRL_M_M_M_SUM_M_CTST", "TSP_MPRL_M_M_M_SUM_M_CTST", "DPP_MPRL_M_M_M_SUM_M_CTST",
			"HZL_MPRL_M_M_M_SUM_M_CTST", "GQL_MPRL_M_M_M_SUM_M_CTST", "SWF_MPRL_M_M_M_SUM_M_CTST" };

	/**
	 * 平均设备容量_6000千瓦及以上火电燃煤指标
	 */
	static final String[] PJSB_HD_RM = new String[] { "SJA_MPRL_M_M_M_SUM_M_CTST", "SJC_MPRL_M_M_M_SUM_M_CTST",
			"ZHP_MPRL_M_M_M_SUM_M_CTST", "HPP_MPRL_M_M_M_SUM_M_CTST", "ZJP_MPRL_M_M_M_SUM_M_CTST",
			"SGY_MPRL_M_M_M_SUM_M_CTST", "MMP_MPRL_M_M_M_SUM_M_CTST", "MXP_MPRL_M_M_M_SUM_M_CTST",
			"YHP_MPRL_M_M_M_SUM_M_CTST", "YLP_MPRL_M_M_M_SUM_M_CTST", "JWP_MPRL_M_M_M_SUM_M_CTST",
			"HHW_MPRL_M_M_M_SUM_M_CTST", "JHP_MPRL_M_M_M_SUM_M_CTST", "PHP_MPRL_M_M_M_SUM_M_CTST",
			"GZH_MPRL_M_M_M_SUM_M_CTST", "TSP_MPRL_M_M_M_SUM_M_CTST", "DPP_MPRL_M_M_M_SUM_M_CTST" };

	/**
	 * 平均设备容量_6000千瓦及以上火电燃气指标
	 */
	static final String[] PJSB_HD_RQ = new String[] { "HZL_MPRL_M_M_M_SUM_M_CTST", "GQL_MPRL_M_M_M_SUM_M_CTST" };

	/**
	 * 平均设备容量_6000千瓦及以上火电其他指标
	 */
	static final String[] PJSB_HD_QT = new String[] { "SWF_MPRL_M_M_M_SUM_M_CTST" };

	/**
	 * 平均设备容量_6000千瓦及以上风电全部指标
	 */
	static final String[] PJSB_FD = new String[] { "SBS_MPRL_M_M_M_SUM_M_CTST", "ZJW_MPRL_M_M_M_SUM_M_CTST",
			"HLW_MPRL_M_M_M_SUM_M_CTST", "DBW_MPRL_M_M_M_SUM_M_CTST", "PXW_MPRL_M_M_M_SUM_M_CTST",
			"ZYW_MPRL_M_M_M_SUM_M_CTST", "SQW_MPRL_M_M_M_SUM_M_CTST" };

	/**
	 * 平均设备容量_6000千瓦及以上太阳能全部指标
	 */
	static final String[] PJSB_TYN = new String[] { "KFE_MPRL_M_M_M_SUM_M_CTST", "YXX_MPRL_M_M_M_SUM_M_CTST" };

	/**
	 * 报表左上角信息设置
	 */
	static final String[] REPORT_DESC = new String[] { "CEC107-6000千瓦及以上电厂发电生产情况（年报）", "425000" };

	/**
	 * 更新IndicatorMapperReport3数据
	 */
	@Transactional
	public Boolean updateDatas(Long time) {
		Date date = new Date(time);
		Calendar cal = Calendar.getInstance();
		cal.setTime(date);
		// 设置用户选择的月份的当月为结束时间
		long endTime = time;
		// 查询IndicatorMapperReport3表中当前时间戳是否存在数据
		List<IndicatorMapperReport3> historyReports = reportRepository.findByTimeOrderByRowIndexAsc(endTime);
		List<IndicatorMapperReport3> reportData = null;
		// 如果存在数据,则需要保留之前页面手动录入的数据。
		if (historyReports.size() != 0) {
			reportData = setUpdateReportData(historyReports, endTime);
		} else {// 如果不存在数据，则直接更新数据
			reportData = new ArrayList<>();
			for (int i = 0; i < ALL_ROW_NAME.length; i++) {
				IndicatorMapperReport3 report = new IndicatorMapperReport3();
				// 设置时间
				report.setTime(endTime);
				// 设置行号
				report.setRowIndex(i + 1);
				String[] rowName = ALL_ROW_NAME[i].split("##");
				// 设置指标名称
				report.setZbmc(rowName[0]);
				// 设置指标代码
				report.setZbdm(rowName[1]);
				// 设置组织机构代码
				if (rowName[2].equals("null")) {
					report.setZzjgdm("");
				} else {
					report.setZzjgdm(rowName[2]);
				}
				report.setQmfdsbrl(0.0);
				report.setGrsbrl(0.0);
				report.setFdcgs(0);
				report.setFdl_by_hj(0.0);
				report.setFdl_by_syx(0.0);
				report.setFdl_lj_hj(0.0);
				report.setFdl_lj_syx(0.0);
				report.setSwdl_by(0.0);
				report.setSwdl_lj(0.0);
				report.setPjlyxs_by(0.0);
				report.setPjlyxs_lj(0.0);
				report.setPjsbrl_by(0.0);
				report.setPjsbrl_lj(0.0);
				// getQmfdsbrl
				reportData.add(report);
			}
			reportData = setUpdateReportData(reportData, endTime);
		}
		List<IndicatorMapperReport3> save = reportRepository.save(reportData);
		return save.size() > 0 ? true : false;
	}

	/**
	 * 从MapperData更新的数据，保存之前手动录入的数据。
	 * 
	 * @param historyReports
	 * @param beginTime
	 * @param endTime
	 * @param oldTime
	 * @return
	 */
	private List<IndicatorMapperReport3> setUpdateReportData(List<IndicatorMapperReport3> historyReports,
			Long endTime) {
		// 设置第1行数据
		// 6000千瓦及以上指标
		List<String> indicatorCodes = Arrays.asList(QMFDSB_ALL);
		// 查询6000千瓦及以上指标去年12月份的数据，求和作为年初生产能力
		List<IndicatorMapperData> findAll = findMapperDatas(indicatorCodes, endTime, endTime);
		// 1. 计算期末发电设备容量
		double qmfdsbSum = mapperDataListSum(findAll);
		// 2. 计算发电量
		indicatorCodes = Arrays.asList(FDL_ALL);
		findAll = findMapperDatas(indicatorCodes, endTime, endTime);
		double fdlSum = mapperDataListSum(findAll);

		// 3. 计算上网电量
		indicatorCodes = Arrays.asList(SWDL_ALL);
		findAll = findMapperDatas(indicatorCodes, endTime, endTime);
		double swdlSum = mapperDataListSum(findAll);

		// 4. 计算平均设备容量
		indicatorCodes = Arrays.asList(PJSB_ALL);
		findAll = findMapperDatas(indicatorCodes, endTime, endTime);
		double pjsbSum = mapperDataListSum(findAll);

		// 设置发电厂个数
		historyReports.get(0).setFdcgs(QMFDSB_ALL.length + 2);
		historyReports = setUpdateColumnData(0, historyReports, qmfdsbSum + historyReports.get(ROW).getQmfdsbrl(),
				fdlSum + historyReports.get(ROW).getFdl_lj_hj(), swdlSum + historyReports.get(ROW).getSwdl_lj(),
				pjsbSum + historyReports.get(ROW).getPjsbrl_lj());

		// 设置第2行数据
		indicatorCodes = Arrays.asList(QMFDSB_SD);
		// 1. 计算水电期末发电设备容量
		findAll = findMapperDatas(indicatorCodes, endTime, endTime);
		double sdQmfdsbSum = mapperDataListSum(findAll);
		// 2. 计算水电发电量
		indicatorCodes = Arrays.asList(FDL_SD);
		findAll = findMapperDatas(indicatorCodes, endTime, endTime);
		double sdFdlSum = mapperDataListSum(findAll);

		// 3. 计算水电上网电量
		indicatorCodes = Arrays.asList(SWDL_SD);
		findAll = findMapperDatas(indicatorCodes, endTime, endTime);
		double sdSwdlSum = mapperDataListSum(findAll);

		// 4. 计算水电平均设备容量
		indicatorCodes = Arrays.asList(PJSB_SD);
		findAll = findMapperDatas(indicatorCodes, endTime, endTime);
		double sdPjsbSum = mapperDataListSum(findAll);

		// 设置发电厂个数
		historyReports.get(1).setFdcgs(QMFDSB_SD.length + 2);
		historyReports = setUpdateColumnData(1, historyReports, sdQmfdsbSum + historyReports.get(ROW + 1).getQmfdsbrl(),
				sdFdlSum + historyReports.get(ROW + 1).getFdl_lj_hj(),
				sdSwdlSum + historyReports.get(ROW + 1).getSwdl_lj(),
				sdPjsbSum + historyReports.get(ROW + 1).getPjsbrl_lj());

		// 设置第4行数据
		indicatorCodes = Arrays.asList(QMFDSB_HD);
		// 1. 计算火电期末发电设备容量
		findAll = findMapperDatas(indicatorCodes, endTime, endTime);
		double hdQmfdsbSum = mapperDataListSum(findAll);
		// 2. 计算火电发电量
		indicatorCodes = Arrays.asList(FDL_HD);
		findAll = findMapperDatas(indicatorCodes, endTime, endTime);
		double hdFdlSum = mapperDataListSum(findAll);
		// 3. 计算火电上网电量
		indicatorCodes = Arrays.asList(SWDL_HD);
		findAll = findMapperDatas(indicatorCodes, endTime, endTime);
		double hdSwdlSum = mapperDataListSum(findAll);
		// 4. 计算火电平均设备容量
		indicatorCodes = Arrays.asList(PJSB_HD);
		findAll = findMapperDatas(indicatorCodes, endTime, endTime);
		double hdPjsbSum = mapperDataListSum(findAll);
		// 设置发电厂个数
		historyReports.get(3).setFdcgs(QMFDSB_HD.length);
		historyReports = setUpdateColumnData(3, historyReports, hdQmfdsbSum + historyReports.get(ROW + 2).getQmfdsbrl(),
				hdFdlSum + historyReports.get(ROW + 2).getFdl_lj_hj(),
				hdSwdlSum + historyReports.get(ROW + 2).getSwdl_lj(),
				hdPjsbSum + historyReports.get(ROW + 2).getPjsbrl_lj());

		// 设置第5行数据
		indicatorCodes = Arrays.asList(QMFDSB_HD_RM);
		// 1. 计算火电燃煤期末发电设备容量
		findAll = findMapperDatas(indicatorCodes, endTime, endTime);
		double hdRmQmfdsbSum = mapperDataListSum(findAll);
		// 2. 计算火电燃煤发电量
		indicatorCodes = Arrays.asList(FDL_HD_RM);
		findAll = findMapperDatas(indicatorCodes, endTime, endTime);
		double hdRmFdlSum = mapperDataListSum(findAll);
		// 3. 计算火电燃煤上网电量
		indicatorCodes = Arrays.asList(SWDL_HD_RM);
		findAll = findMapperDatas(indicatorCodes, endTime, endTime);
		double hdRmSwdlSum = mapperDataListSum(findAll);
		// 4. 计算火电燃煤平均设备容量
		indicatorCodes = Arrays.asList(PJSB_HD_RM);
		findAll = findMapperDatas(indicatorCodes, endTime, endTime);
		double hdRmPjsbSum = mapperDataListSum(findAll);

		// 设置发电厂个数
		historyReports.get(4).setFdcgs(QMFDSB_HD_RM.length);
		historyReports = setUpdateColumnData(4, historyReports,
				hdRmQmfdsbSum + historyReports.get(ROW + 3).getQmfdsbrl(),
				hdRmFdlSum + historyReports.get(ROW + 3).getFdl_lj_hj(),
				hdRmSwdlSum + historyReports.get(ROW + 3).getSwdl_lj(),
				hdRmPjsbSum + historyReports.get(ROW + 3).getPjsbrl_lj());

		// 设置第7行数据
		indicatorCodes = Arrays.asList(QMFDSB_HD_RQ);
		// 1. 计算火电燃气期末发电设备容量
		findAll = findMapperDatas(indicatorCodes, endTime, endTime);
		double hdRqQmfdsbSum = mapperDataListSum(findAll);
		// 2. 计算火电燃气发电量
		indicatorCodes = Arrays.asList(FDL_HD_RQ);
		findAll = findMapperDatas(indicatorCodes, endTime, endTime);
		double hdRqFdlSum = mapperDataListSum(findAll);
		// 3. 计算火电燃气上网电量
		indicatorCodes = Arrays.asList(SWDL_HD_RQ);
		findAll = findMapperDatas(indicatorCodes, endTime, endTime);
		double hdRqSwdlSum = mapperDataListSum(findAll);
		// 4. 计算火电燃气平均设备容量
		indicatorCodes = Arrays.asList(PJSB_HD_RQ);
		findAll = findMapperDatas(indicatorCodes, endTime, endTime);
		double hdRqPjsbSum = mapperDataListSum(findAll);

		// 设置发电厂个数
		historyReports.get(6).setFdcgs(QMFDSB_HD_RQ.length);
		historyReports = setUpdateColumnData(6, historyReports,
				hdRqQmfdsbSum + historyReports.get(ROW + 4).getQmfdsbrl(),
				hdRqFdlSum + historyReports.get(ROW + 4).getFdl_lj_hj(),
				hdRqSwdlSum + historyReports.get(ROW + 4).getSwdl_lj(),
				hdRqPjsbSum + historyReports.get(ROW + 4).getPjsbrl_lj());

		// 设置第11行数据
		indicatorCodes = Arrays.asList(QMFDSB_HD_QT);
		// 1. 计算火电其他期末发电设备容量
		findAll = findMapperDatas(indicatorCodes, endTime, endTime);
		double hdQtQmfdsbSum = mapperDataListSum(findAll);
		// 2. 计算火电其他发电量
		indicatorCodes = Arrays.asList(FDL_HD_QT);
		findAll = findMapperDatas(indicatorCodes, endTime, endTime);
		double hdQtFdlSum = mapperDataListSum(findAll);
		// 3. 计算火电其他上网电量
		indicatorCodes = Arrays.asList(SWDL_HD_QT);
		findAll = findMapperDatas(indicatorCodes, endTime, endTime);
		double hdQtSwdlSum = mapperDataListSum(findAll);
		// 4. 计算火电其他平均设备容量
		indicatorCodes = Arrays.asList(PJSB_HD_QT);
		findAll = findMapperDatas(indicatorCodes, endTime, endTime);
		double hdQtPjsbSum = mapperDataListSum(findAll);

		// 设置发电厂个数
		historyReports.get(10).setFdcgs(QMFDSB_HD_QT.length);
		historyReports = setUpdateColumnData(10, historyReports,
				hdQtQmfdsbSum + historyReports.get(ROW + 8).getQmfdsbrl(),
				hdQtFdlSum + historyReports.get(ROW + 8).getFdl_lj_hj(),
				hdQtSwdlSum + historyReports.get(ROW + 8).getSwdl_lj(),
				hdQtPjsbSum + historyReports.get(ROW + 8).getPjsbrl_lj());

		// 设置第14行数据
		// 设置发电厂个数
		historyReports.get(13).setFdcgs(QMFDSB_HD_QT.length);
		historyReports = setUpdateColumnData(13, historyReports, hdQtQmfdsbSum, hdQtFdlSum, hdQtSwdlSum, hdQtPjsbSum);

		// 设置第16行数据
		indicatorCodes = Arrays.asList(QMFDSB_FD);
		// 1. 计算风电期末发电设备容量
		findAll = findMapperDatas(indicatorCodes, endTime, endTime);
		double fdQmfdsbSum = mapperDataListSum(findAll);
		// 2. 计算风电发电量
		indicatorCodes = Arrays.asList(FDL_FD);
		findAll = findMapperDatas(indicatorCodes, endTime, endTime);
		double fdFdlSum = mapperDataListSum(findAll);
		// 3. 计算风电上网电量
		indicatorCodes = Arrays.asList(SWDL_FD);
		findAll = findMapperDatas(indicatorCodes, endTime, endTime);
		double fdSwdlSum = mapperDataListSum(findAll);
		// 4. 计算风电平均设备容量
		indicatorCodes = Arrays.asList(PJSB_FD);
		findAll = findMapperDatas(indicatorCodes, endTime, endTime);
		double fdPjsbSum = mapperDataListSum(findAll);

		// 设置发电厂个数
		historyReports.get(15).setFdcgs(QMFDSB_FD.length);
		historyReports = setUpdateColumnData(15, historyReports,
				fdQmfdsbSum + historyReports.get(ROW + 12).getQmfdsbrl(),
				fdFdlSum + historyReports.get(ROW + 12).getFdl_lj_hj(),
				fdSwdlSum + historyReports.get(ROW + 12).getSwdl_lj(),
				fdPjsbSum + historyReports.get(ROW + 12).getPjsbrl_lj());

		// 设置第17行数据
		indicatorCodes = Arrays.asList(QMFDSB_TYN);
		// 1. 计算水电期末发电设备容量
		findAll = findMapperDatas(indicatorCodes, endTime, endTime);
		double tynQmfdsbSum = mapperDataListSum(findAll);
		// 2. 计算水电发电量
		indicatorCodes = Arrays.asList(FDL_TYN);
		findAll = findMapperDatas(indicatorCodes, endTime, endTime);
		double tynFdlSum = mapperDataListSum(findAll);
		// 3. 计算水电上网电量
		indicatorCodes = Arrays.asList(SWDL_TYN);
		findAll = findMapperDatas(indicatorCodes, endTime, endTime);
		double tynSwdlSum = mapperDataListSum(findAll);
		// 4. 计算水电平均设备容量
		indicatorCodes = Arrays.asList(PJSB_TYN);
		findAll = findMapperDatas(indicatorCodes, endTime, endTime);
		double tynPjsbSum = mapperDataListSum(findAll);

		// 设置发电厂个数
		historyReports.get(16).setFdcgs(QMFDSB_TYN.length);
		historyReports = setUpdateColumnData(16, historyReports,
				tynQmfdsbSum + historyReports.get(ROW + 13).getQmfdsbrl(),
				tynFdlSum + historyReports.get(ROW + 13).getFdl_lj_hj(),
				tynSwdlSum + historyReports.get(ROW + 13).getSwdl_lj(),
				tynPjsbSum + historyReports.get(ROW + 13).getPjsbrl_lj());

		// 设置第22行数据
		// 设置发电厂个数
		historyReports.get(21).setFdcgs(QMFDSB_ALL.length);
		historyReports = setUpdateColumnData(21, historyReports, qmfdsbSum, fdlSum, swdlSum, pjsbSum);

		// 设置第23行数据
		// 设置发电厂个数
		historyReports.get(22).setFdcgs(QMFDSB_SD.length);
		historyReports = setUpdateColumnData(22, historyReports, sdQmfdsbSum, sdFdlSum, sdSwdlSum, sdPjsbSum);

		// 设置第25行数据
		// 设置发电厂个数
		historyReports.get(24).setFdcgs(QMFDSB_HD.length);
		historyReports = setUpdateColumnData(24, historyReports, hdQmfdsbSum, hdFdlSum, hdSwdlSum, hdPjsbSum);

		// 设置第26行数据
		// 设置发电厂个数
		historyReports.get(25).setFdcgs(QMFDSB_HD_RM.length);
		historyReports = setUpdateColumnData(25, historyReports, hdRmQmfdsbSum, hdRmFdlSum, hdRmSwdlSum, hdRmPjsbSum);

		// 设置第28行数据
		// 设置发电厂个数
		historyReports.get(27).setFdcgs(QMFDSB_HD_RQ.length);
		historyReports = setUpdateColumnData(27, historyReports, hdRqQmfdsbSum, hdRqFdlSum, hdRqSwdlSum, hdRqPjsbSum);

		// 设置第32行数据
		// 设置发电厂个数
		historyReports.get(31).setFdcgs(QMFDSB_HD_QT.length);
		historyReports = setUpdateColumnData(31, historyReports, hdQtQmfdsbSum, hdQtFdlSum, hdQtSwdlSum, hdQtPjsbSum);

		// 设置第35行数据
		// 设置发电厂个数
		historyReports.get(34).setFdcgs(QMFDSB_HD_QT.length);
		historyReports = setUpdateColumnData(34, historyReports, hdQtQmfdsbSum, hdQtFdlSum, hdQtSwdlSum, hdQtPjsbSum);

		// 设置第37行数据
		// 设置发电厂个数
		historyReports.get(36).setFdcgs(QMFDSB_FD.length);
		historyReports = setUpdateColumnData(36, historyReports, fdQmfdsbSum, fdFdlSum, fdSwdlSum, fdPjsbSum);

		// 设置第38行数据
		// 设置发电厂个数
		historyReports.get(37).setFdcgs(QMFDSB_TYN.length);
		historyReports = setUpdateColumnData(37, historyReports, tynQmfdsbSum, tynFdlSum, tynSwdlSum, tynPjsbSum);

		// 设置第61行数据
		historyReports = setUpdateColumnData(60, historyReports, qmfdsbSum, fdlSum, swdlSum, pjsbSum);

		// 遍历6000千瓦及以上电厂明细指标
		for (int i = 0; i < QMFDSB_ALL.length; i++) {
			IndicatorMapperData indicatorMapperData = null;
			// 1. 计算期末发电设备容量
			double dcQmfdsbSum = 0.0;
			if (!QMFDSB_ALL[i].equals("")) {
				indicatorMapperData = mapperDataService.findByIndicatorCodeAndTime(QMFDSB_ALL[i], endTime);
				dcQmfdsbSum = indicatorMapperData.getValue();
			}
			// 2. 计算发电量
			double dcFdlSum = 0.0;
			if (!FDL_ALL[i].equals("")) {
				indicatorMapperData = mapperDataService.findByIndicatorCodeAndTime(FDL_ALL[i], endTime);
				dcFdlSum = indicatorMapperData.getValue();
			}
			// 3. 计算上网电量
			double dcSwdlSum = 0.0;
			if (!SWDL_ALL[i].equals("")) {
				indicatorMapperData = mapperDataService.findByIndicatorCodeAndTime(SWDL_ALL[i], endTime);
				dcSwdlSum = indicatorMapperData.getValue();
			}
			// 4. 计算平均设备容量
			double dcPjsbSum = 0.0;
			if (!PJSB_ALL[i].equals("")) {
				indicatorMapperData = mapperDataService.findByIndicatorCodeAndTime(PJSB_ALL[i], endTime);
				dcPjsbSum = indicatorMapperData.getValue();
			}
			// 设置发电厂个数
			historyReports.get(61 + i).setFdcgs(1);
			historyReports = setUpdateColumnData(61 + i, historyReports, dcQmfdsbSum, dcFdlSum, dcSwdlSum, dcPjsbSum);

		}
		return historyReports;
	}

	/**
	 * 设置MapperDataList查询方法
	 */
	private List<IndicatorMapperData> findMapperDatas(List<String> indicatorCodes, Long beginTime, Long endTime) {
		List<SearchFilter> searchFilters = new ArrayList<>();
		searchFilters.add(SearchFilter.in("indicatorCode", indicatorCodes));
		searchFilters.add(SearchFilter.ge("time", beginTime));
		searchFilters.add(SearchFilter.le("time", endTime));
		Specification<IndicatorMapperData> buildAndSpec = JpaSearchUtils.buildAndSpec(searchFilters);
		List<IndicatorMapperData> findAll = mapperDataService.findAll(buildAndSpec);
		return findAll;
	}

	/**
	 * 设置MapperDataList求和方法
	 */
	private double mapperDataListSum(List<IndicatorMapperData> mapperDataList) {
		return mapperDataList.stream().mapToDouble(x -> x.getValue()).summaryStatistics().getSum();
	}

	/**
	 * 设置每行的年初生产能力、年末生产能力、本年减少能力和发电量
	 */
	private List<IndicatorMapperReport3> setUpdateColumnData(Integer index, List<IndicatorMapperReport3> historyReports,
			Double qmfdsbrl, Double fdl, Double swdl, Double pjsbrl) {
		// 1.期末发电设备容量
		historyReports.get(index).setQmfdsbrl(qmfdsbrl);
		// 2.发电量
		historyReports.get(index).setFdl_lj_hj(fdl);
		// 3.发电量
		historyReports.get(index).setSwdl_lj(swdl);
		// 4. 平均利用小时
		if (pjsbrl > 0) {
			historyReports.get(index).setPjlyxs_lj(
					historyReports.get(index).getFdl_lj_hj() / historyReports.get(index).getPjsbrl_lj() * 10000);
		} else {
			historyReports.get(index).setPjlyxs_lj(0.0);
		}
		// 5. 平均设备容量
		historyReports.get(index).setPjsbrl_lj(pjsbrl);
		return historyReports;
	}

	/**
	 * 查询报表数据
	 * 
	 * @param time
	 * @return
	 */
	public List<IndicatorMapperReport3> findByTime(Long time) {
		return reportRepository.findByTimeOrderByRowIndexAsc(time);
	}

	/**
	 * 导出报表
	 */
	public HSSFWorkbook exportReport(List<IndicatorMapperReport3> reportDataList) {
		// 创建工作簿
		HSSFWorkbook workBook = new HSSFWorkbook();
		// 创建工作表 工作表的名字叫helloWorld
		HSSFSheet sheet = workBook.createSheet("工作表1");
		// 创建左上角固定报表描述表格
		sheet = creatRepotDesc(workBook, sheet, reportDataList.get(0).getTime());

		// 创建下方主报表
		sheet = creatMainRepot(workBook, sheet, reportDataList);
		return workBook;
	}

	/**
	 * 创建左上角报表
	 * 
	 * @param sheet
	 * @param time
	 * @return
	 */
	public HSSFSheet creatRepotDesc(HSSFWorkbook workBook, HSSFSheet sheet, Long time) {
		// 设置字体样式
		HSSFFont font = workBook.createFont();
		font.setColor(HSSFFont.COLOR_RED);

		// 创建第1行
		HSSFRow row_1 = sheet.createRow(0);
		HSSFCell row_1_cell_1 = row_1.createCell(0);
		row_1_cell_1.setCellValue("*");
		HSSFCell row_1_cell_2 = row_1.createCell(1);
		row_1_cell_2.setCellValue("");
		HSSFCell row_1_cell_3 = row_1.createCell(2);
		row_1_cell_3.setCellValue("1.本表头供系统识别使用；\r\n" + "2.各单位根据具体情况填写单位代码、单位名称、填报人；\r\n" + "3.本表头报告期必须与此报表报告期一致；\r\n"
				+ "4.指标代码必须按照规律编；\r\n" + "5.不可改动报表格式。");
		// 创建第2行
		HSSFRow row_2 = sheet.createRow(1);
		HSSFCell row_2_cell_1 = row_2.createCell(0);
		HSSFRichTextString richString = new HSSFRichTextString("广东粤电集团有限公司");
		richString.applyFont(font);
		row_2_cell_1.setCellValue(richString);
		HSSFCell row_2_cell_2 = row_2.createCell(1);
		row_2_cell_2.setCellValue("（单位名称）");

		// 创建第3行
		HSSFRow row_3 = sheet.createRow(2);
		HSSFCell row_3_cell_1 = row_3.createCell(0);
		richString = new HSSFRichTextString("9808000001");
		richString.applyFont(font);
		row_3_cell_1.setCellValue(richString);
		HSSFCell row_3_cell_2 = row_3.createCell(1);
		row_3_cell_2.setCellValue("（单位代码）");

		// 创建第4行
		HSSFRow row_4 = sheet.createRow(3);
		HSSFCell row_4_cell_1 = row_4.createCell(0);
		richString = new HSSFRichTextString("统计专责");
		richString.applyFont(font);
		row_4_cell_1.setCellValue(richString);
		HSSFCell row_4_cell_2 = row_4.createCell(1);
		row_4_cell_2.setCellValue("（填报人）");

		// 创建第5行
		HSSFRow row_5 = sheet.createRow(4);
		HSSFCell row_5_cell_1 = row_5.createCell(0);
		row_5_cell_1.setCellValue(REPORT_DESC[0]);
		HSSFCell row_5_cell_2 = row_5.createCell(1);
		row_5_cell_2.setCellValue("（表名）");

		// 创建第6行
		HSSFRow row_6 = sheet.createRow(5);
		HSSFCell row_6_cell_1 = row_6.createCell(0);
		row_6_cell_1.setCellValue(REPORT_DESC[1]);
		HSSFCell row_6_cell_2 = row_6.createCell(1);
		row_6_cell_2.setCellValue("（表号）");

		// 创建第7行
		HSSFRow row_7 = sheet.createRow(6);
		HSSFCell row_7_cell_1 = row_7.createCell(0);
		row_7_cell_1.setCellValue("1");
		HSSFCell row_7_cell_2 = row_7.createCell(1);
		row_7_cell_2.setCellValue("（期别）");

		// 创建第8行
		Calendar cal = Calendar.getInstance();
		Date date = new Date(time);
		cal.setTime(date);
		HSSFRow row_8 = sheet.createRow(7);
		HSSFCell row_8_cell_1 = row_8.createCell(0);
		row_8_cell_1.setCellValue(new HSSFRichTextString(String.valueOf(cal.get(Calendar.YEAR))));
		HSSFCell row_8_cell_2 = row_8.createCell(1);
		row_8_cell_2.setCellValue("年");
		HSSFCell row_8_cell_3 = row_8.createCell(2);
		row_8_cell_3.setCellValue(new HSSFRichTextString(String.valueOf(cal.get(Calendar.MONTH) + 1)));
		HSSFCell row_8_cell_4 = row_8.createCell(3);
		row_8_cell_4.setCellValue("月");
		HSSFCell row_8_cell_5 = row_8.createCell(4);
		row_8_cell_5.setCellValue("");

		sheet.addMergedRegion(new CellRangeAddress(0, 6, 2, 2));

		return sheet;
	}

	/**
	 * 创建下方主要表格
	 * 
	 * @param sheet
	 * @param reportDataList
	 * @return
	 */
	@SuppressWarnings("deprecation")
	public HSSFSheet creatMainRepot(HSSFWorkbook workBook, HSSFSheet sheet,
			List<IndicatorMapperReport3> reportDataList) {
		// 创建红色居中样式
		HSSFCellStyle cellStyle = workBook.createCellStyle();
		// 设置居中样式
		cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
		cellStyle.setAlignment(HSSFCellStyle.VERTICAL_CENTER);
		// 设置字体样式
		HSSFFont font = workBook.createFont();
		font.setColor(HSSFFont.COLOR_RED);
		cellStyle.setFont(font);

		// 创建第9行
		HSSFRow row_9 = sheet.createRow(8);
		HSSFCell row_9_cell_1 = row_9.createCell(0);
		row_9_cell_1.setCellValue("6000千瓦及以上电厂发电生产情况");
		row_9_cell_1.setCellStyle(cellStyle);

		// 创建第10行
		HSSFRow row_10 = sheet.createRow(9);
		HSSFCell row_10_cell_1 = row_10.createCell(0);
		row_10_cell_1.setCellValue("综合填报单位：  （章）");
		HSSFCell row_10_cell_2 = row_10.createCell(1);
		row_10_cell_2.setCellValue("");
		HSSFCell row_10_cell_3 = row_10.createCell(2);
		row_10_cell_3.setCellValue("");
		HSSFCell row_10_cell_4 = row_10.createCell(3);
		row_10_cell_4.setCellValue("");
		HSSFCell row_10_cell_5 = row_10.createCell(4);
		row_10_cell_5.setCellValue("");
		HSSFCell row_10_cell_6 = row_10.createCell(5);
		row_10_cell_6.setCellValue("");
		HSSFCell row_10_cell_7 = row_10.createCell(6);
		row_10_cell_7.setCellValue("");
		HSSFCell row_10_cell_8 = row_10.createCell(7);
		row_10_cell_8.setCellValue("YYYY");
		HSSFCell row_10_cell_9 = row_10.createCell(8);
		row_10_cell_9.setCellValue("");
		HSSFCell row_10_cell_10 = row_10.createCell(9);
		row_10_cell_10.setCellValue("");
		HSSFCell row_10_cell_11 = row_10.createCell(10);
		row_10_cell_11.setCellValue("");
		HSSFCell row_10_cell_12 = row_10.createCell(11);
		row_10_cell_12.setCellValue("");

		// 创建第11行
		HSSFRow row_11 = sheet.createRow(10);
		HSSFCell row_11_cell_1 = row_11.createCell(0);
		row_11_cell_1.setCellValue("指标名称");
		HSSFCell row_11_cell_2 = row_11.createCell(1);
		row_11_cell_2.setCellValue("指标代码");
		HSSFCell row_11_cell_3 = row_11.createCell(2);
		row_11_cell_3.setCellValue("组织机构代码");
		HSSFCell row_11_cell_4 = row_11.createCell(3);
		row_11_cell_4.setCellValue("发电厂个数");
		HSSFCell row_11_cell_5 = row_11.createCell(4);
		row_11_cell_5.setCellValue("期末发电设备容量");
		HSSFCell row_11_cell_6 = row_11.createCell(6);
		row_11_cell_6.setCellValue("发电量（万千瓦时）");
		HSSFCell row_11_cell_7 = row_11.createCell(10);
		row_11_cell_7.setCellValue("上网电量");
		HSSFCell row_11_cell_8 = row_11.createCell(12);
		row_11_cell_8.setCellValue("平均利用小时");
		HSSFCell row_11_cell_9 = row_11.createCell(14);
		row_11_cell_9.setCellValue("平均设备容量");

		// 创建第12行
		HSSFRow row_12 = sheet.createRow(11);
		HSSFCell row_12_cell_1 = row_12.createCell(4);
		row_12_cell_1.setCellValue("（千瓦）");
		HSSFCell row_12_cell_2 = row_12.createCell(5);
		row_12_cell_2.setCellValue("其中：供热设备容量");
		HSSFCell row_12_cell_3 = row_12.createCell(6);
		row_12_cell_3.setCellValue("本月");
		HSSFCell row_12_cell_4 = row_12.createCell(8);
		row_12_cell_4.setCellValue("累计");
		HSSFCell row_12_cell_5 = row_12.createCell(10);
		row_12_cell_5.setCellValue("（万千瓦时）");
		HSSFCell row_12_cell_6 = row_12.createCell(12);
		row_12_cell_6.setCellValue("（小时）");
		HSSFCell row_12_cell_7 = row_12.createCell(14);
		row_12_cell_7.setCellValue("（千瓦）");

		// 创建第13行
		HSSFRow row_13 = sheet.createRow(12);
		HSSFCell row_13_cell_1 = row_13.createCell(3);
		row_13_cell_1.setCellValue("（个）");
		HSSFCell row_13_cell_2 = row_13.createCell(6);
		row_13_cell_2.setCellValue("合计");
		HSSFCell row_13_cell_3 = row_13.createCell(7);
		row_13_cell_3.setCellValue("试运行");
		HSSFCell row_13_cell_4 = row_13.createCell(8);
		row_13_cell_4.setCellValue("合计");
		HSSFCell row_13_cell_5 = row_13.createCell(9);
		row_13_cell_5.setCellValue("试运行");
		HSSFCell row_13_cell_6 = row_13.createCell(10);
		row_13_cell_6.setCellValue("本月");
		HSSFCell row_13_cell_7 = row_13.createCell(11);
		row_13_cell_7.setCellValue("累计");
		HSSFCell row_13_cell_8 = row_13.createCell(12);
		row_13_cell_8.setCellValue("本月");
		HSSFCell row_13_cell_9 = row_13.createCell(13);
		row_13_cell_9.setCellValue("累计");
		HSSFCell row_13_cell_10 = row_13.createCell(14);
		row_13_cell_10.setCellValue("本月");
		HSSFCell row_13_cell_11 = row_13.createCell(15);
		row_13_cell_11.setCellValue("累计");

		// 创建第14行
		HSSFRow row_14 = sheet.createRow(13);
		HSSFCell row_14_cell_1 = row_14.createCell(0);
		row_14_cell_1.setCellValue("甲");
		HSSFCell row_14_cell_2 = row_14.createCell(1);
		row_14_cell_2.setCellValue("1");
		HSSFCell row_14_cell_3 = row_14.createCell(2);
		row_14_cell_3.setCellValue("2");
		HSSFCell row_14_cell_4 = row_14.createCell(3);
		row_14_cell_4.setCellValue("3");
		HSSFCell row_14_cell_5 = row_14.createCell(4);
		row_14_cell_5.setCellValue("4");
		HSSFCell row_14_cell_6 = row_14.createCell(5);
		row_14_cell_6.setCellValue("5");
		HSSFCell row_14_cell_7 = row_14.createCell(6);
		row_14_cell_7.setCellValue("6");
		HSSFCell row_14_cell_8 = row_14.createCell(7);
		row_14_cell_8.setCellValue("7");
		HSSFCell row_14_cell_9 = row_14.createCell(8);
		row_14_cell_9.setCellValue("8");
		HSSFCell row_14_cell_10 = row_14.createCell(9);
		row_14_cell_10.setCellValue("9");
		HSSFCell row_14_cell_11 = row_14.createCell(10);
		row_14_cell_11.setCellValue("10");
		HSSFCell row_14_cell_12 = row_14.createCell(11);
		row_14_cell_12.setCellValue("11");
		HSSFCell row_14_cell_13 = row_14.createCell(12);
		row_14_cell_13.setCellValue("12");
		HSSFCell row_14_cell_14 = row_14.createCell(13);
		row_14_cell_14.setCellValue("13");
		HSSFCell row_14_cell_15 = row_14.createCell(14);
		row_14_cell_15.setCellValue("14");
		HSSFCell row_14_cell_16 = row_14.createCell(15);
		row_14_cell_16.setCellValue("15");

		for (IndicatorMapperReport3 report : reportDataList) {
			HSSFRow row = sheet.createRow(report.getRowIndex() + ROW_INDEX);
			// 设置第1列
			HSSFCell cell_1 = row.createCell(0);
			cell_1.setCellValue(report.getZbmc());
			// 设置第2列
			HSSFCell cell_2 = row.createCell(1);
			cell_2.setCellValue(report.getZbdm());
			// 设置第3列
			HSSFCell cell_3 = row.createCell(2);
			cell_3.setCellValue(report.getZzjgdm());
			// 设置第4列
			HSSFCell cell_4 = row.createCell(3);
			cell_4.setCellValue(report.getFdcgs());
			// 设置第5列
			HSSFCell cell_5 = row.createCell(4);
			cell_5.setCellValue(report.getQmfdsbrl());
			// 设置第6列
			HSSFCell cell_6 = row.createCell(5);
			cell_6.setCellValue(report.getGrsbrl());
			// 设置第7列
			HSSFCell cell_7 = row.createCell(6);
			cell_7.setCellValue(report.getFdl_by_hj());
			// 设置第8列
			HSSFCell cell_8 = row.createCell(7);
			cell_8.setCellValue(report.getFdl_by_syx());
			// 设置第9列
			HSSFCell cell_9 = row.createCell(8);
			cell_9.setCellValue(report.getFdl_lj_hj());
			// 设置第10列
			HSSFCell cell_10 = row.createCell(9);
			cell_10.setCellValue(report.getFdl_lj_syx());
			// 设置第11列
			HSSFCell cell_11 = row.createCell(10);
			cell_11.setCellValue(report.getSwdl_by());
			// 设置第12列
			HSSFCell cell_12 = row.createCell(11);
			cell_12.setCellValue(report.getSwdl_lj());
			// 设置第13列
			HSSFCell cell_13 = row.createCell(12);
			cell_13.setCellValue(report.getPjlyxs_by());
			// 设置第14列
			HSSFCell cell_14 = row.createCell(13);
			cell_14.setCellValue(report.getPjlyxs_lj());
			// 设置第13列
			HSSFCell cell_15 = row.createCell(14);
			cell_15.setCellValue(report.getPjlyxs_by());
			// 设置第13列
			HSSFCell cell_16 = row.createCell(15);
			cell_16.setCellValue(report.getPjsbrl_lj());
		}

		// 合并6000千瓦及以上电厂发电生产情况单元格
		sheet.addMergedRegion(new CellRangeAddress(8, 8, 0, 15));
		// 合并YYYY
		sheet.addMergedRegion(new CellRangeAddress(9, 9, 6, 9));
		// 合并指标名称单元格
		sheet.addMergedRegion(new CellRangeAddress(10, 12, 0, 0));
		// 合并指标代码单元格
		sheet.addMergedRegion(new CellRangeAddress(10, 12, 1, 1));
		// 合并组织机构代码单元格
		sheet.addMergedRegion(new CellRangeAddress(10, 12, 2, 2));
		// 合并发电厂个数单元格
		sheet.addMergedRegion(new CellRangeAddress(10, 11, 3, 3));

		// 合并期末发电设备容量单元格
		sheet.addMergedRegion(new CellRangeAddress(10, 10, 4, 5));
		// 合并期末发电设备容量（千瓦）单元格
		sheet.addMergedRegion(new CellRangeAddress(11, 12, 4, 4));
		// 合并其中：供热设备容量单元格
		sheet.addMergedRegion(new CellRangeAddress(11, 12, 5, 5));

		// 合并发电量（万千瓦时）单元格
		sheet.addMergedRegion(new CellRangeAddress(10, 10, 6, 9));
		// 合并发电量（万千瓦时）本月单元格
		sheet.addMergedRegion(new CellRangeAddress(11, 11, 6, 7));
		// 合并发电量（万千瓦时）累计单元格
		sheet.addMergedRegion(new CellRangeAddress(11, 11, 8, 9));

		// 合并上网电量单元格
		sheet.addMergedRegion(new CellRangeAddress(10, 10, 10, 11));
		// 合并上网电量（万千瓦时）单元格
		sheet.addMergedRegion(new CellRangeAddress(11, 11, 10, 11));

		// 合并平均利用小时单元格
		sheet.addMergedRegion(new CellRangeAddress(10, 10, 12, 13));
		// 合并平均利用小时（小时）单元格
		sheet.addMergedRegion(new CellRangeAddress(11, 11, 12, 13));

		// 合并平均设备容量单元格
		sheet.addMergedRegion(new CellRangeAddress(10, 10, 14, 15));
		// 合并平均设备容量（千瓦）单元格
		sheet.addMergedRegion(new CellRangeAddress(11, 11, 14, 15));
		return sheet;
	}
}
